C3: Use latest version of @cloudflare/workers-types in workers projects#4525
C3: Use latest version of @cloudflare/workers-types in workers projects#4525
Conversation
Installing these as part of the generator instead of relying on a stale version in the template we copied ensures we have the most up-to-date version.
🦋 Changeset detectedLatest commit: 2e08b32 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
A create-cloudflare (C3) prerelease is available for testing. npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs//npm-package-create-cloudflare-Note that these links will no longer work once the GitHub Actions artifact expires. |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Looks good to me 🙂
The tests look really nice! 🤩👍
As I mentioned in chat, I am not really convinced that installing wrangler and @cloudflare/workers-types is the right approach as having them in the package.jsons with ^ should be enough, but if you strongly believe that it is I am fine with it 🙂
I tell you what, let's compromise. I'll leave FWIW this code will likely be revisited in the near future as we add support for non built-in templates. |
|
@jculvey no please don't worry I am totally fine with installing both |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4525 +/- ##
==========================================
+ Coverage 75.44% 75.48% +0.03%
==========================================
Files 240 240
Lines 12851 12851
Branches 3309 3309
==========================================
+ Hits 9695 9700 +5
+ Misses 3156 3151 -5 |
Fixes #4514.
What this PR solves / how to test:
Workers projects created via c3 get a stale version of
@cloudflare/workers-typesfrom their template files and use the default entrypoint in theirtsconfig.json. This makes for a rough experience for typescript users.This change fixes that by installing both
wranglerand@cloudflare/workers-typeson demand, and by looking up the latest version of the types entrypoint and adjusting the tsconfig.Author has addressed the following:
Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr reviewso future reviewers can take inspiration and learn from it.